//
//  YSReadPageBackViewController.m
//  YSBookRead
//
//  Created by MOLBASE on 2018/11/8.
//  Copyright © 2018年 YangShen. All rights reserved.
//

#import "YSReadPageBGViewController.h"
#import "YSReadHelper.h"

@interface YSReadPageBGViewController ()
@end

@implementation YSReadPageBGViewController {
    UIImageView *_imageView;
}

+ (instancetype)readPageBGViewControllerWith:(YSReadPageController *)readPageVC {
    YSReadPageBGViewController *readVC = [[YSReadPageBGViewController alloc] init];
    readVC->_readPageVC = readPageVC;
    return readVC;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    // imageView
    _imageView = [[UIImageView alloc] init];
    _imageView.backgroundColor = [UIColor lightGrayColor];
    _imageView.frame = self.view.bounds;
    _imageView.layer.transform = CATransform3DMakeRotation(M_PI, 0, 1, 0);
    [self.view addSubview:_imageView];

    // 展示图片
    if (self.readPageVC.view) {
        _imageView.image = [YSReadHelper screenCapture:self.readPageVC.view];
    }
}

- (void)dealloc {
    _imageView.image = nil;
}

@end
